<template>
	<view class="container">
		<view class="grade-header">
			<view class="grade-header_title text_black">{{grade.section_name}}{{grade.grade_name}}</view>
			<view class="grade-header_tips text_black">以下是您批改训练计划的班级</view>
		</view>
		<view class="grade-content">
			<view class="grade-content_grade">
				<view class="grade-content_grade_item" 
				v-for="(item,index) in classList" :key="index" @click="selectCourse(item)">
					{{item.class_name}}
					<image src="../../../static/imgs/mine/right.png"></image>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {getSchoolClass} from "../../../static/js/api/training.js";
	export default{
		data(){
			return{
				grade:{},
				classList:[],
			}
		},
		onLoad(option) {
			this.grade = JSON.parse(option.grade)
			console.log(this.grade)
			this.getData(this.grade.id)
			uni.setNavigationBarTitle({
				title:"组织学生进行体测 "+this.grade.section_name+this.grade.grade_name
			})
		},
		methods:{
			getData(id){
				getSchoolClass({
					grade_id:id
				}).then(res=>{
					console.log(res)
					this.classList = res
				})
			},
			selectCourse(item){
				let params = {
					class_id:item.id,
					class_name:item.class_name,
					section_name:this.grade.section_name,
					grade_name:this.grade.grade_name,
				}
				uni.navigateTo({
					url:'/pages/releasePlan/staminaTest/student?params='+JSON.stringify(params)
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	@import url("./index.scss");
	
</style>